<template>
  <div id="app">
    <router-view />

    <van-tabbar v-show="$route.meta===true" route v-model="active" active-color="darkred" inactive-color="#000">
      <van-tabbar-item to="/home" name="home" icon="home-o">首页</van-tabbar-item>
      <van-tabbar-item to="/topic" name="label" icon="label-o">专题</van-tabbar-item>
      <van-tabbar-item to="/category" name="category" icon="apps-o">分类</van-tabbar-item>
      <van-tabbar-item to="/cart" name="cart" icon="cart-o">购物车</van-tabbar-item>
      <van-tabbar-item to="/user" name="user" icon="user-o">我的</van-tabbar-item>
    </van-tabbar>

  </div>
</template>
<script>
  export default {
    data() {
      return {
        active: 'home',

      }
    },
    watch:{
      '$route':{
        handler(val,old){
          document.documentElement.scrollTop=0
        },
        deep: true,
        immediate: true
      }
    },
    // mounted(){
    //   document.documentElement.scrollTop=0
    // }
  }
</script>


<style lang="less">
  #app {
    background-color: rgb(239, 239, 239);
    font-family: "黑体";
    width: 100%;
    height: 100%;
  }



  body {
      font-family: "黑体";
      font-size: 14px;
      color: #333;
      font-weight: normal;
      background-color: #efefef;

    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
      font-weight: normal;
      margin: 0;
    }
  }
</style>